Skip to content

IMAGING-394: Report truncated and overlong runs in RGBE scan lines - #576

Open
Marti2203 wants to merge 1 commit into
apache:masterfrom
Marti2203:rgbe-truncated-runs
Open

Marti2203 wants to merge 1 commit into
apache:masterfrom
Marti2203:rgbe-truncated-runs

Conversation

@Marti2203

Copy link
Copy Markdown

Fixes IMAGING-394.

RgbeInfo.decompress() checked for the end of the stream only at a run's count byte: a run's value and literal bytes were stored from in.read() unchecked, so a truncated HDR decoded silently with 0xFF bytes, and a run longer than the rest of the scan line threw ArrayIndexOutOfBoundsException. Both now throw an ImagingException.

RgbeParserTest.testTruncatedAndOverlongRuns decodes a complete 4x1 image, the same image cut off inside its last run, and a scan line with an overlong run; it fails without the change. The RGBE tests and mvn -B -DskipTests -DskipITs pass.

This issue was found by an LLM-Enhanced Static Analysis Engine and verified manually. The patch and this description were prepared with AI assistance (Claude Code) and reviewed by me; the commit carries an Assisted-By: trailer.

RgbeInfo.decompress() stored in.read() results without checking for
the end of the stream, so a truncated file decoded with 0xFF bytes, and
did not check that a run fits in the scan line, so a long run threw
ArrayIndexOutOfBoundsException. Throw an ImagingException in both cases.

Assisted-By: Claude Code:claude-opus-5-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant